<?php

namespace App\Webdisk\Model;

use Illuminate\Database\Eloquent\Model;

class User extends Model
{
    protected $table = "user";
    public $timestamps = false;

    /**
     * @param string 用户名
     * @return \Illuminate\Database\Eloquent\Collection|bool
     */
    static function getByUser($user){
        $data = self::where(['user'=>$user])->get();
        if($data->isEmpty()){
            return false;
        }else{
            return $data[0];
        }
    }

    /**
     * @param string token
     * @return \Illuminate\Database\Eloquent\Collection|bool
     */
    static function getByToken($token){
        return self::where(['token'=>$token])->first();
    }
}
